/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package yoga.probability;

import java.util.Random;

/**
 *
 * @author Yogev Montekyo
 */
public final class Probablistics
{
    private final static Random random = new Random();

    public static boolean randomBoolean(double probability)
    {
        boolean result = false;

        if (random.nextFloat() <= probability)
        {
            result = true;
        }

        return result;
    }
    
    public static int getRandomInt(int max)
    {
        int result = 0;
        if (max > 0)
        {
            result = random.nextInt(max);
        }
        return result;
    }
    
    public static double getRandomFloatWithinRange(double lowerBoundary, double upperBoundary)
    {
        double size = upperBoundary - lowerBoundary;
        double randomFloat = size * random.nextDouble() + lowerBoundary;
        return randomFloat;
    }
    
}
